import pygame
import random


class food(object):

    def __init__(self):
        self.food_color = pygame.Color(255, 0, 0)
        pass


    def make_food(self, whether_eat, not_body_list, food_list):
        if whether_eat == 1:
            position = random.randrange(1, len(not_body_list))
            food_list = not_body_list[position]
            whether_eat = 0
        return whether_eat, food_list


    def draw_food(self, food_list, window, grid_size):
        x = (food_list[0] - 1) * grid_size[0]
        y = (food_list[1] - 1) * grid_size[1]
        rec = (x, y, grid_size[0], grid_size[1])
        pygame.draw.rect(window, self.food_color, rec)
